/*
*  This file is part of mangusta
*
*  mangusta is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  mangusta is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with mangusta; if not, write to the Free Software
*  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  US
*
*  Author: <antonino.calderone@ericsson.com>, <acaldmail@gmail.com>
*
*/


/* -------------------------------------------------------------------------- */

#ifndef __NU_STMT_DECL_H__
#define __NU_STMT_DECL_H__


/* -------------------------------------------------------------------------- */

#include "nu_stmt.h"
#include "nu_variable.h"
#include "nu_var_scope.h"
#include "nu_token_list.h"
#include "nu_expr_any.h"

#include <string>


/* -------------------------------------------------------------------------- */

namespace nu
{


// -------------------------------------------------------------------------

class stmt_decl_t : public stmt_t
{
public:
   using arg_t = expr_any_t::handle_t;

   stmt_decl_t() = delete;
   stmt_decl_t(const stmt_decl_t&) = delete;
   stmt_decl_t& operator=(const stmt_decl_t&) = delete;

   stmt_decl_t(
      prog_ctx_t & ctx,
      const std::string& variable,
      arg_t arg,
      expr_any_t::handle_t vect_idx,
      bool constant,
      bool reference,
      variable_t::type_t vartype)
      :
      stmt_t(ctx),
      _variable(variable),
      _arg(arg),
      _vect_idx(vect_idx),
      _constant(constant),
      _reference(reference),
      _vartype(vartype)
   {}

   virtual void run(rt_prog_ctx_t& ctx) override;

protected:
   std::string _variable;
   arg_t _arg;
   expr_any_t::handle_t _vect_idx;
   bool _constant = false;
   bool _reference = false;
   variable_t::type_t _vartype;
};


// -------------------------------------------------------------------------


}

/* -------------------------------------------------------------------------- */

#endif //__NU_STMT_DECL_H__